//
//  Tool.m
//  UI_lesson_12_UITableViewCellHeight
//
//  Created by lanou3g on 16/3/2.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "Tool.h"

@implementation Tool
//创建类计算lable的高度
+ (CGFloat) lableHeightWithText:(NSString *)text font:(UIFont *)font
{
    CGSize size = CGSizeMake([[UIScreen mainScreen] bounds].size.width, 100000);
    NSDictionary *dic = @{NSFontAttributeName:font};
    CGRect rect = [text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return rect.size.height;
    
    
}
//创建类方法根据image计算imageView的高度
+ (CGFloat) imageScaleHeightWith:(NSString *)imageName
{
    UIImage *image = [UIImage imageNamed:imageName];
    CGFloat width = image.size.width;
    CGFloat height = image.size.height;
    return height/width *[[UIScreen mainScreen] bounds].size.width;
}

@end
